using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Data_ReflectionModel_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Data.ReflectionModel);

            field = type.GetField("name", flag);
            app.RegisterCLRFieldGetter(field, get_name_0);
            app.RegisterCLRFieldSetter(field, set_name_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_name_0, AssignFromStack_name_0);
            field = type.GetField("field", flag);
            app.RegisterCLRFieldGetter(field, get_field_1);
            app.RegisterCLRFieldSetter(field, set_field_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_field_1, AssignFromStack_field_1);
            field = type.GetField("FieldType", flag);
            app.RegisterCLRFieldGetter(field, get_FieldType_2);
            app.RegisterCLRFieldSetter(field, set_FieldType_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_FieldType_2, AssignFromStack_FieldType_2);
            field = type.GetField("Value", flag);
            app.RegisterCLRFieldGetter(field, get_Value_3);
            app.RegisterCLRFieldSetter(field, set_Value_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_Value_3, AssignFromStack_Value_3);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Data.ReflectionModel());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Data.ReflectionModel[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }



        static object get_name_0(ref object o)
        {
            return ((huqiang.Data.ReflectionModel)o).name;
        }

        static StackObject* CopyToStack_name_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.ReflectionModel)o).name;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_name_0(ref object o, object v)
        {
            ((huqiang.Data.ReflectionModel)o).name = (System.String)v;
        }

        static StackObject* AssignFromStack_name_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.String @name = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Data.ReflectionModel)o).name = @name;
            return ptr_of_this_method;
        }

        static object get_field_1(ref object o)
        {
            return ((huqiang.Data.ReflectionModel)o).field;
        }

        static StackObject* CopyToStack_field_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.ReflectionModel)o).field;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_field_1(ref object o, object v)
        {
            ((huqiang.Data.ReflectionModel)o).field = (System.Reflection.FieldInfo)v;
        }

        static StackObject* AssignFromStack_field_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Reflection.FieldInfo @field = (System.Reflection.FieldInfo)typeof(System.Reflection.FieldInfo).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Data.ReflectionModel)o).field = @field;
            return ptr_of_this_method;
        }

        static object get_FieldType_2(ref object o)
        {
            return ((huqiang.Data.ReflectionModel)o).FieldType;
        }

        static StackObject* CopyToStack_FieldType_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.ReflectionModel)o).FieldType;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_FieldType_2(ref object o, object v)
        {
            ((huqiang.Data.ReflectionModel)o).FieldType = (System.Type)v;
        }

        static StackObject* AssignFromStack_FieldType_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Type @FieldType = (System.Type)typeof(System.Type).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Data.ReflectionModel)o).FieldType = @FieldType;
            return ptr_of_this_method;
        }

        static object get_Value_3(ref object o)
        {
            return ((huqiang.Data.ReflectionModel)o).Value;
        }

        static StackObject* CopyToStack_Value_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.ReflectionModel)o).Value;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance, true);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method, true);
        }

        static void set_Value_3(ref object o, object v)
        {
            ((huqiang.Data.ReflectionModel)o).Value = (System.Object)v;
        }

        static StackObject* AssignFromStack_Value_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Object @Value = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Data.ReflectionModel)o).Value = @Value;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Data.ReflectionModel();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
